package com.mbdz.util;

import cn.hutool.jwt.JWTUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * projectName:mbtisys
 * author:JunJie
 * time:2024/11/4 19:16
 * description:
 */

public class TokenUtil {

    /**
     * 生成令牌
     * @param content
     * @return
     */
    public static String createToken(String content){
        Map<String,Object> phyload = new HashMap<>();
        phyload.put("content",content);
        phyload.put("ctime",System.currentTimeMillis());
        return JWTUtil.createToken(phyload,"hospitalsys".getBytes());
    }

    public static String parseToken(String token){
        return JWTUtil.parseToken(token).getPayload("content").toString();
    }
}
